GEMDOS Calls via Trap 1

#include osbind.h>

The following assignment is valid by default:

Devicehandle


CON:0Keyboard CON:1Screen AUX:2Serial port PRN:3Parallel port

long Cauxin(); Read character from standart AUX:.

short Cauxis(); Check, if character is available from standart AUX:.

short Cauxos(); Check, if character can be written to standart AUX:.

void Cauxout(short c); Write character c to standart AUX:.

long Cconin(); Read a character from standart CON:.

short Cconis(); Check, if character is available from standart CON:.

short Cconos(); Check, if character can be written to standart CON:.

void Cconout(short c); Write character c to standart CON:.

void Cconrs(char &sstarf#star;buf); Read edited data from standart CON:. buf[0] contains number of characters minus 1 to read.

void Cconws(const char &sstarf#star;str); Write string str to standart CON:.

long Cnecin(); Raw input from standart CON: without echoing to screen, but with interpretation of CTRL-S, CRTL-Q and CRTL-C.

short Cprnos(); Check, if character can be written to standart PRN:.

void Cprnout(short c); Write character c to standart PRN:.

long Crawcin(); Raw input from standart CON: without echoing to screen.

long Crawio(short data); Raw I/O to standart CON:. If data = 0xff read from CON:, otherwise output to CON:.

short Dcreate(const char &sstarf#star;dname); Create a directory with name dname.

long Ddelete(const char &sstarf#star;dname); Remove a directory with name dname.

long Dfree(DISKINFO &sstarf#star;buf, short drv); Get available space of drive drv into buf. drv = 0 means current drive.

short Dgetdrv(); Get the number of the default drive.

long Dgetpath(void &sstarf#star;buf, short drv); Get the current directory of drive drv. drv = 0 means current drive.

long Dsetdrv(short d); Set the number of the default drive.

long Dsetpath(const char &sstarf#star;path); Set path for current drive to path.

short Fattrib(const char &sstarf#star;fname, short rwflag, short attr); Get (rwflag = 0) or set (rwflag = 1) attribute byte of file fname.

long Fclose(short handle); Close the file assosiated with handle.

struct _dta &sstarf#star;Fgetdta(); Get the current disk transfer address.

long Fcreate(const char &sstarf#star;fname, short mode); Create file fname with mode mode.

long Fdatime(DOSTIME &sstarf#star;timeptr, short hdl, short rwflg); Get (rwflag = 0) or set (rwflg = 1) the time structure of the file associated by handle hdl.

long Fdelete(const char &sstarf#star;fname); Delete file with name fname.

long Fdup(short handle); Return a second handle for a standart handle (0…5).

long Fforce(short Hstd, short Hnew); Replace one of the standart handles (0…5) with Hnew.

long Fopen(const char &sstarf#star;fname, short mode); Open file fname with mode mode.

long Fread(short handle, long cnt, void &sstarf#star;buf); Read cnt bytes into buf from file assosiated with handle.

short Frename(const char &sstarf#star;old, const char &sstarf#star;new); Change name of file from old to new. Also directories

long Fseek(long pos, short handle, short whence); Set access pointer to position pos relative to whence.

void Fsetdta(struct _dta &sstarf#star;ptr); Set the current disk tranfer address to ptr.

long Fsfirst(const char &sstarf#star;filespec, short attr); Get first directory slot, which matches filespec and attr.

long Fsnext(); Get next match of search started by Fsfirst.

long Fwrite(short handle, long cnt, const void &sstarf#star;buf); Write cnt bytes from buf to file assosiated with handle.

long Malloc(long size); Allocate size bytes of memory.

long Mfree(void &sstarf#star;ptr); Release block of memory.

long Mshrink(long ptr, long size); Shrink size of memory block obtained by Malloc.

long Pexec(short mode, const char &sstarf#star;prog, const char &sstarf#star;tail, char &sstarf#star;&sstarf#star;env); Execute prog with mode mode. The following bits in the a_ldflags of the programm header modify behaviour:

BitMeaning


0Fastload bit (clear only BSS) 1load into fast ram (TT) 2satisfy Malloc()s from fast ram (TT) 3…27reserved 28…31TPA size field (TT)

void Pterm(short rv); Terminate current process with return value rv.

void Pterm0(); Terminate current and return to calling process.

void Ptermres(long save, short ret); Terminate and stay resident, but keep save bytes of memory.

long Super(void &sstarf#star;stack); Inquire (stack = 1), set (stack = 0) or return from (stack > 0) supervisor mode.

short Sversion(); Get the version number of GEMDOS.

short Tgetdate(); Get the GEMDOS internal date. The harware clock is read in MEGA ST's.

=The return value is composed of the following fields:

BitsMeaning (Range)


0…4Day (0…31) 5…8Month (1…12) 9…15Year (0…119)(+1980)

short Tgettime(); Get the GEMDOS internal time.

=The return value is composed of the following fields:

BitsMeaning (Range)


0…4Seconds (0…29) have to be doubled 5…10Minutes (0…59) 11…15Hours (0…23)

long Tsetdate(short date); Set the GEMDOS internal date.

long Tsettime(short time); Set the GEMDOS internal time.